import * as questionApi from '../../api/hmmm/questions'
const questionInfo = {
  namespaced: true,
  state: {
    // 基础题库列表
    questionList: {},
    // 题库详情
    questionDetail: {},
    // 精选列表
    questionChoice: {}
  },
  mutations: {
    SET_QUESTION_LIST: (state, newValue) => {
      state.questionList = newValue
    },
    SET_QUESTION_DETAIL: (state, newValue) => {
      state.questionDetail = newValue
    },
    SET_QUESTION_CGOICE: (state, newValue) => {
      state.questionChoice = newValue
    },

  },
  actions: {
    async updateQuetionList (context, data) {
      const res = await questionApi.getQuestionList(data)
      context.commit('SET_QUESTION_LIST', res)
    },
    async updateQuetionDetail (context, data) {
      const res = await questionApi.detail(data)
      context.commit('SET_QUESTION_DETAIL', res)
    },
    async updateQuetionChoice (context, data) {
      const res = await questionApi.choice(data)
      context.commit('SET_QUESTION_CGOICE', res)
    },
  }
}

export default questionInfo
